<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set var="path" value="${pageContext.request.contextPath}" />
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="Generator" content="EditPlus®">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
<title>新生报到系统</title>
<%-- <link rel="stylesheet" type="text/css"
	href="${path}/css/studentlogin.css" /> --%>
<link rel="stylesheet" href="${path}/css/bootstrap.css">
<script src="${path}/js/jquery-3.4.1.min.js"></script>
<script src="${path}/js/bootstrap.min.js"></script>
<style type="text/css">
body {
	background: #ffffff url(../images/login/1.jpg);
	background-size: 100% 100%;
}
</style>
</head>
<body>
	<div style="height: 30%">
		<input type="hidden" value="${student.id}">
	</div>
	<div class="container">
		<div class="row clearfix">
			<div class="col-md-4 column"></div>
			<div class="col-md-4 column">
				<form role="form" action="/student/tlogin2" method="post"
					enctype="multipart/form-data">
					<h2 style="text-align: center; color: white;">登陆</h2>
					<div class="form-group">
						<input type="text" placeholder="姓名" class="form-control"
							name="username" value="${student.username }" required="required" />
					</div>
					<div class="form-group">
						<input type="text" placeholder="学号" class="form-control"
							name="studentid" value="${student.studentid }"
							onkeyup="value=value.replace(/[^\d]/g,'')" required=" required" />
					</div>
					<div class="form-group">
						<input type="password" placeholder="请输入密码" required="required"
							class="form-control" name="password" maxlength="15" />
					</div>
					<button type="submit" class="btn btn-default"
						style="width: 60%; background-color: blue; color: white;">登陆</button>
					<a id="button_wj" href="javascript:void(0);">忘记密码？</a><a
						href="login?out=true">取消？</a>
				</form>
			</div>
			<div class="col-md-4 column"></div>
		</div>
	</div>
	<script type="text/javascript">
		if ("${type}" == "error") {
			alert("${msg }");
		}
		if ("${type}" == "success") {
			alert("${msg }");
			window.location.href = 'index';
		}
		$(document).ready(function() {
			$('#button_wj').click(function() {
				var NameAndStudentid = prompt("请输入您的姓名与学号，用#隔开", ""); //将输入的内容赋给变量 name ，  

				//这里需要注意的是，prompt有两个参数，前面是提示的话，后面是当对话框出来后，在对话框里的默认值  

				if (NameAndStudentid) //如果返回的有内容  
				{
					//异步提交请求数据
					$.ajax({
						type : 'POST',
						dataType : 'json',
						url : 'czpad',
						data : {
							NameAndStudentid : NameAndStudentid
						},
						success : function(result) {
							//console.log(result);
							if (result.type == 'success') {
								Email(NameAndStudentid);
							} else {
								alert(result.msg);
							}
						}
					});

				} else {
					alert("您未输入任何内容！");
				}

				function Email(NameAndStudentid) {
					var Email = prompt("请输入您要重置密码要发送的邮箱", "");
					if (Email) {
						$.ajax({
							url : 'czpad',
							type : 'post',
							dataType : 'json',
							data : {
								NameAndStudentid : NameAndStudentid,
								Email : Email
							},
							success : function(result) {
								if (result.type == 'success') {
									alert(result.msg)
									location.href = 'login2';
								} else {
									alert(result.msg);
								}
							}
						});
					} else {
						alert("您未填写任何内容！");
					}

				}
			})

		});
	</script>
</body>
</html>
